package com.sgsg.templatemodule;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;


/***
 * 模板模式:
 *通过把不变行为搬移到超类，去除子类中的重复代码来体现它的优势
 *
 */

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        IWork work1 = new WorkA();
        work1.startWork();
        IWork work2 = new WorkB();
        work2.startWork();
        Log.i("tag",work2.getType());
    }
}
